package traceMyItems.business;

import java.util.*;
import java.util.logging.Logger;


import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.apache.commons.lang.NotImplementedException;

import com.google.appengine.api.datastore.Key;
@PersistenceCapable
public class StatusNode {
	private static final Logger log = Logger.getLogger(StatusNode.class.getName());
	

	
	@Persistent
	private StatusType objStatusType;
	@Persistent
	private List<StatusNode> lstNextStatusNodes;
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key=null;
	
	
	public void createKey() {
        //this.key = KeyFactory.createKey(User.class.getSimpleName(), strUsername+":"+strEmail);
		///TODO: Aun queda crear criterio de creacion de clave para esta clase
		this.key = null;
    }
	
	public Key getKey()
	{
		return key;
	}
	
	public StatusNode() {
		super();
		lstNextStatusNodes = new ArrayList<StatusNode>();
	}
	
	public StatusType getStatusType() throws NotImplementedException
	{
		return objStatusType;
	}
	
	public void setStatusType(StatusType objStatusTypeParam) throws NotImplementedException
	{
		objStatusType = objStatusTypeParam;
	}

	@SuppressWarnings("null")
	public List<StatusType> getNextStatus() throws NotImplementedException
	{
		List<StatusType> lstNextStatusTypes = new ArrayList<StatusType>();
		
		for(StatusNode objNextStatusNode: lstNextStatusNodes)
		{
			lstNextStatusTypes.add(objNextStatusNode.getStatusType());
		}
		return lstNextStatusTypes;		
	}
	
	public void addNextStatus(StatusNode objStatusNode) throws NotImplementedException
	{
		lstNextStatusNodes.add(objStatusNode);
	}

	public void removeNextStatus(StatusNode objStatusNode) throws NotImplementedException
	{
		lstNextStatusNodes.remove(objStatusNode);
	}
	
}
